<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="~{common/header :: commonHead}">
    <title>限制详情</title>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="row form-body form-horizontal m-t" method="post" th:action="${'/marking_rule/edit'}">
                        <input name="id" th:value="${editable?.id}" style="display: none">
                        <div class="col-md-12 droppable sortable ui-droppable ui-sortable">
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">新会员注册是否送积分：</label>
                                <div class="col-sm-6">
                                    <div class="radio radio-info radio-inline">
                                        <input type="radio" id="inlineRadio1" name="newMemberIntegral" value="1" th:checked="${editable?.newMemberIntegral == true}">
                                        <label for="inlineRadio1">是 </label>
                                    </div>
                                    <div class="radio radio-danger radio-inline">
                                        <input type="radio" id="inlineRadio2" name="newMemberIntegral" value="0" th:checked="${editable?.newMemberIntegral == false}">
                                        <label for="inlineRadio2">否 </label>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group draggable ui-draggable dropped" id="birth_day_num" th:style="${'position: static; display:' + (editable?.newMemberIntegral == true ? 'block' : 'none')}" >
                                <label class="col-sm-3 control-label">新会员注册赠送积分：</label>
                                <div class="col-sm-6">
                                    <input type="text" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" name="rewardIntegral" required="required" class="form-control" th:value="${editable?.rewardIntegral }" placeholder="新会员注册赠送积分(注：此处只可填 ' >= 0' 的整数)">
                                </div>
                            </div>

                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">新会员注册是否送优惠券：</label>
                                <div class="col-sm-6">
                                    <div class="radio radio-info radio-inline">
                                        <input type="radio" id="inlineRadio3" name="newMemberCoupom" value="1" th:checked="${editable?.newMemberCoupom == true}">
                                        <label for="inlineRadio3">是 </label>
                                    </div>
                                    <div class="radio radio-danger radio-inline">
                                        <input type="radio" id="inlineRadio4" name="newMemberCoupom" value="0" th:checked="${editable?.newMemberCoupom == false}">
                                        <label for="inlineRadio4">否 </label>
                                    </div>
                                </div>
                            </div>

                           <!-- <div class="form-group draggable ui-draggable dropped" id="coupon_ids" th:style="${'position: static; display:' + (editable?.newMemberCoupom == true ? 'block' : 'none')}">
                                <label class="col-sm-3 control-label">新会员注册赠送优惠券：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="coupomIds" class="form-control" th:value="${editable?.coupomIds }" placeholder="请选择优惠券">
                                </div>
                            </div>-->


                            <div class="form-group draggable ui-draggable dropped" id="coupon_ids"
                                 th:style="${'position: static; display:' + (editable?.newMemberCoupom == true ? 'block' : 'none')}">
                                <label class="col-sm-3 control-label">新会员注册赠送优惠券：</label>
                                <div class="col-sm-6">
                                    <select required id="orgId2" name="coupomIds" data-placeholder="请选择赠送优惠券..."
                                            class="chosen-select form-control m-b" tabindex="1">
                                        <option value="" th:selected="${editable?.coupomIds == null}">--请选择--</option>
                                        <option class="id_option" hassubinfo="true"
                                                th:each="couponDTO:${couponDTOS}"
                                                th:selected="${editable?.coupomIds == couponDTO.id}"
                                                th:value="${couponDTO.id }"
                                                th:text="${couponDTO.name}"></option>
                                    </select>
                                </div>
                            </div>



                            <div class="form-group draggable ui-draggable dropped" id="coupon_num" th:style="${'position: static; display:' + (editable?.newMemberCoupom == true ? 'block' : 'none')}">
                                <label class="col-sm-3 control-label">新会员注册赠送每张优惠券数量：</label>
                                <div class="col-sm-6">
                                    <input type="text" id="coupon_num_count" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" required="required" name="coupomCountNum" class="form-control" th:value="${editable?.coupomCountNum }" placeholder="新会员注册赠送优惠券数量(注：此处只可填 ' >= 0' 的整数)">
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">新会员注册是否送停车券：</label>
                                <div class="col-sm-6">
                                    <div class="radio radio-info radio-inline">
                                        <input type="radio"  id="inlineRadio5" name="newMemberParkingCoupom" value="1" th:checked="${editable?.newMemberParkingCoupom == true}">
                                        <label for="inlineRadio5">是 </label>
                                    </div>
                                    <div class="radio radio-danger radio-inline">
                                        <input type="radio"  id="inlineRadio6" name="newMemberParkingCoupom" value="0" th:checked="${editable?.newMemberParkingCoupom == false}">
                                        <label for="inlineRadio6">否 </label>
                                    </div>
                                </div>
                            </div>
                          <!--  <div class="form-group draggable ui-draggable dropped" id="parking_coupon_ids" th:style="${'position: static; display:' + (editable?.newMemberParkingCoupom == true ? 'block' : 'none')}">
                                <label class="col-sm-3 control-label">新会员注册赠送停车券：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="coupomParkingIds" class="form-control" th:value="${editable?.coupomParkingIds }" placeholder="请选择优惠券">
                                </div>
                            </div>-->

                            <div class="form-group draggable ui-draggable dropped" id="parking_coupon_ids"
                                 th:style="${'position: static; display:' + (editable?.newMemberParkingCoupom == true ? 'block' : 'none')}">
                                <label class="col-sm-3 control-label">新会员注册赠送停车券：</label>
                                <div class="col-sm-6">
                                    <select id="orgId"  name="coupomParkingIds" data-placeholder="请选择赠送停车券..."
                                            class="chosen-select form-control m-b" tabindex="1">
                                        <option value="" th:selected="${editable?.coupomParkingIds == null}">--请选择--</option>
                                        <option class="id_option" hassubinfo="true"
                                                th:each="parkingCouponDTO:${parkingCouponDTOS}"
                                                th:selected="${editable?.coupomParkingIds == parkingCouponDTO.id}"
                                                th:value="${parkingCouponDTO.id }"
                                                th:text="${parkingCouponDTO.name}"></option>
                                    </select>
                                </div>
                            </div>


                            <div class="form-group draggable ui-draggable dropped" id="parking_coupon_num" th:style="${'position: static; display:' + (editable?.newMemberParkingCoupom == true ? 'block' : 'none')}">
                                <label class="col-sm-3 control-label">新会员注册赠送每张停车券数量：</label>
                                <div class="col-sm-6">
                                    <input type="text"id="parking_coupon" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" required="required" name="coupomParkingCountNum" class="form-control" th:value="${editable?.coupomParkingCountNum }" placeholder="新会员注册赠送停车券数量(注：此处只可填 ' >= 0' 的整数)">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group draggable ui-draggable">
                                <div class="col-sm-12 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">保存内容</button>
                                </div>
                            </div>

                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/js/plugins/chosen/chosen.jquery.js"></script>
<script th:inline="javascript">
    $("input[name=newMemberIntegral]").change(function () {
        let selection = $(this).val();
        if (selection == 1) {
            $("#birth_day_num").css('display','block');
            $("#birth_day_num").attr('required','required');

        }
        if (selection == ''||selection == 0) {
            $("#birth_day_num").css('display','none');
        }
    })
    $("input[name=newMemberCoupom]").change(function () {
        let selection = $(this).val();
        if (selection == 1) {
            $("#coupon_ids").css('display','block');
            $("#coupon_num").css('display','block');
            $("#orgId2").attr('required','required');
            $("#coupon_num_count").attr('required','required');
        }
        if (selection == ''||selection == 0) {
            $("#coupon_ids").css('display','none');
            $("#coupon_num").css('display','none');
        }
    })

    $("input[name=newMemberParkingCoupom]").change(function () {
        let selection = $(this).val();
        if (selection == 1) {
            $("#parking_coupon_ids").css('display','block');
            $("#parking_coupon_num").css('display','block');
            $("#orgId").attr('required','required');
            $("#parking_coupon").attr('required','required');
        }
        if (selection == ''||selection == 0) {
            $("#parking_coupon_ids").css('display','none');
            $("#parking_coupon_num").css('display','none');
        }
    })
    $(function () {

        $("#orgId").comboSelect();
        $("#orgId2").comboSelect();

    });
</script>
</body>
</html>